-
-
Notifications
You must be signed in to change notification settings - Fork 3.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Using {{ super() }}
for extending a block
#4309
Conversation
Yesterday we were struggling with adding a Zendesk widget (a simple JS) to our docs, because overriding any existing template block would lead to a broken site. Finally, we found this function which saved us. I wanted to share this, because it's not a common knowledge and it might be helpful for others.
Thanks for the PR! Shouldn't it be after the block statement, so that it's in the block? |
I'm not sure. It works for us when it's before block. But it can be at the end as well. Both ways are presented here. |
I'm not sure we're talking about the same thing. Please provide an example for clarification. |
OK, so this is how we implemented the Zendesk widget:
Now I got your point: I meant the new content in a block, but wrote about a block statement. My bad. Yes, this super function should be invoked inside the block, but I am not sure if it really matters if it's before or after the new content. |
Thanks! Yes, it matters. The content of the block is expanded where the super call is located, so order definitely matters. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
correction to instructions
Thanks! LGTM. I might adjust the formatting a little. |
Yesterday we were struggling with adding a Zendesk widget (a simple JS) to our docs, because overriding any existing template block would lead to a broken site. Finally, we found this function which saved us. I wanted to share this, because it's not a common knowledge and it might be helpful for others.